# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>
# Contributor: Andrzej Giniewicz <gginiu@gmail.com>
# Contributor: Nishit Joseph (reachjlight at gmail dot com)
# Contributor: Martin Corley <Martin.Corley@ed.ac.uk>

pkgname=python-openpyxl
# https://openpyxl.readthedocs.io/en/stable/changes.html
pkgver=3.1.2
pkgrel=2
pkgdesc="A Python library to read/write Excel 2007 xlsx/xlsm files"
arch=('any')
url="https://openpyxl.readthedocs.org/"
license=('MIT')
depends=('python' 'python-et-xmlfile')
makedepends=('python-setuptools' 'python-defusedxml')
checkdepends=('python-pytest' 'python-py' 'python-lxml' 'python-pandas' 'python-pillow')
optdepends=('python-pillow: needed to include images'
            'python-lxml: alternative XML backend'
            'python-defusedxml: guard against various XML vulnerabilities'
            'python-pandas: for iteration over Pandas DataFrames')
source=("https://foss.heptapod.net/openpyxl/openpyxl/-/archive/${pkgver}/openpyxl-${pkgver}.tar.bz2")
sha256sums=('421e13e7004f6fee7cf84c1b9fa738615bf409ff2b57e2227be75452f7608c12')

build() {
  cd "$srcdir"/openpyxl-${pkgver}
  python setup.py build
}

check() {
  cd "$srcdir"/openpyxl-${pkgver}
  pytest
}

package() {
  cd "$srcdir"/openpyxl-${pkgver}
  python setup.py install --skip-build --root="$pkgdir" --optimize=1
  install -Dm644 LICENCE.rst "$pkgdir"/usr/share/licenses/$pkgname/LICENCE
}
